﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Nuzzle.Protocol.Types.Game.Look
{
    public class EntityLook
    {
        public short BonesID { get; set; }
        public List<int> Skins { get; set; }
        public List<int> IndexedColors { get; set; }
        public List<int> Scales { get; set; }

        public EntityLook(short bonesId, List<int> skins, List<int> indexedColors, List<int> scales)
        {
            this.BonesID = bonesId;
            this.Skins = skins;
            this.IndexedColors = indexedColors;
            this.Scales = scales;
        }

        public void Serialize(NetworkMessage message)
        {
            message.WriterBuffer.writeShort(this.BonesID);

            message.WriterBuffer.writeShort((short)this.Skins.Count);
            this.Skins.ForEach(x => message.WriterBuffer.writeShort((short)x));

            message.WriterBuffer.writeShort((short)this.IndexedColors.Count);
            this.IndexedColors.ForEach(x => message.WriterBuffer.writeInt(x));

            message.WriterBuffer.writeShort((short)this.Scales.Count);
            this.Scales.ForEach(x => message.WriterBuffer.writeShort((short)x));

            message.WriterBuffer.writeShort(0);//TODO
        }
    }
}
